package main

func minimumPartition(s string, k int) int {
	count := 0
	val := 0
	for _, c := range s {
		num := int(c - '0')
		if num > k {
			return -1
		}
		nextVal := val*10 + num
		if nextVal > k {
			// 进行一次分割
			val = num
			count++
		} else {
			val = nextVal
		}
	}
	return count + 1
}

func main() {
	println(minimumPartition("165462", 60))
	println(minimumPartition("165462", 6))
}
